/**
 * 
 */
package com.mycompany.client.widgets;

import com.mycompany.shared.EnvConstants;
import com.smartgwt.client.types.Alignment;
import com.smartgwt.client.util.SC;
import com.smartgwt.client.widgets.Label;
import com.smartgwt.client.widgets.events.IconClickEvent;
import com.smartgwt.client.widgets.events.IconClickHandler;
import com.smartgwt.client.widgets.layout.HLayout;

/**
 * @author coral.ma
 *
 */
public class CoralPageTitle extends HLayout {
	
	private String helpTitle = "";
	private int height = 16;
	
	public CoralPageTitle(String title, final String help) {
		setWidth100();
		setHeight(height);
		setPadding(EnvConstants.PADDING);
		Label titleLabel = new Label(title);
		titleLabel.setAlign(Alignment.LEFT);
		titleLabel.setWidth("90%");
		titleLabel.setHeight(height);
		titleLabel.setStyleName("pageTitle");
		addMember(titleLabel);
		
		Label helpLabel = new Label(helpTitle);
		helpLabel.setWidth("10%");
		helpLabel.setHeight(height);
		helpLabel.setAlign(Alignment.RIGHT);
		helpLabel.setIcon("[SKIN]/actions/help.png");
		helpLabel.addIconClickHandler(new IconClickHandler() {  
            public void onIconClick(IconClickEvent event) {  
                SC.say(help);  
            }
        });
		addMember(helpLabel);
	}

}
